#pragma once
#include <memory>
#include "vector3.h"

namespace krryn{
namespace audio{
	class listener{
	public:
		typedef listener* ptr;

		math::vector3f m_Position;
		math::vector3f m_LookAt;
		math::vector3f m_Up;

		listener() : m_Position(0, 0, 0), m_LookAt(-1, 0, 0), m_Up(0, 1, 0) {}

		// if return > 0 then sample is to the right
		// range f: [-1, 1]
		// left volume: 1 - ((1 + f) / 2)
		// right volume:     (1 + f) / 2
		float pan_for_position(math::vector3f a_Position){

			math::vector3f A = m_LookAt.cross(m_Up).normalize(); // right
			math::vector3f B = (m_Position - a_Position).normalize(); // distance

			return A.dot(B);
		}
	};
}
}
